import { createApp } from "vue";

import { createPinia } from "pinia";
//引入element-plus
import App from "./App.vue";

import router from "./router";
import ElementPlus from "element-plus";
import myconfig from "@/utils/myconfig";
//引入element-plus样式
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import "@/styles/index.css";
import zhCn from "element-plus/es/locale/lang/zh-cn";
import "./permission";
import { permission } from "./divertive/permission";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import hasPerm from "./divertive/hasPerm";
//引入持久化插件

const app = createApp(App);
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
app.use(ElementPlus, {
  locale: zhCn,
});
app.directive("permission", permission);
app.use(router);
app.use(pinia);

app.use(ElementPlus);
//使用持久化插件

//全局引入element-plus

//全局注册图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
app.mount("#app");
//全局注册myconfig
app.config.globalProperties.$myconfig = myconfig;
/* app.config.globalProperties.$hasPerm =hasPerm */
